<?php

class Core_Frontend_Domain extends Dcmp_Domain_Base{

	protected $name = 'frontend';	
	
	protected function initialize() {
        $themeName = 'default';
        $skinName = 'default';
        $templatePaths = array(DP_DESIGN . strtolower($this->getName()) . DS . $themeName . DS);
        $htmlPaths = array(DP_DESIGN . strtolower($this->getName()) . DS . $themeName . DS . 'html' . DS);
        
		$this->getConfig()->setSetting('themeName', $themeName);
		$this->getConfig()->setSetting('skinName', $skinName);
		$this->getConfig()->setSetting('templateDirectories', $templatePaths);
		
		$localizeCode = $this->getApplication()->getConfig()->getSetting('localize');
		$this->getConfig()->setSetting('localizeCode', $localizeCode);
        Kd_Html_Config::setTemplatePaths($htmlPaths);
        Kd_Localize_Config::setLocalizeCode($localizeCode);
        $files = Kd_Util_IO::getFiles(DP_LOCALIZE . $localizeCode);
        foreach ($files as $file) {
            Kd_Localize_Factory::getTranslator()->loadFile($file['name'], $file['filename']);
        }

//        Kd_Web::getVariables()
//                ->setData('base_url', $baseUrl)
//                ->setData('theme_name', $themeName)
//                ->setData('skin_name', $skinName)
//                ->setData('template_paths', $templatePaths)
//                ->setData('pub_url', $baseUrl . "pub/")
//                ->setData('route_base_url', $routeBaseUrl)
//                ->setData('localize_code', 'zh_cn');
		parent::initialize();
	}
	
	protected function route() {
		$this->currentStep = 'route';
		$this->nextStep = 'filter';
		Kd_Web::getRouter()->route();
	}	
}